﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Ex03.GarageLogic
{
    public class Wheel
    {
        private string m_ManufacturerName;
        private float m_CurrentAirPressure;
        private float m_MaximalAirPressure;

        public string ManufacturerName
        {
            get { return m_ManufacturerName; }
        }

        public float CurrentAirPressure
        {
            get { return m_CurrentAirPressure; }
        }

        public float MaximalAirPressure
        {
            get { return m_MaximalAirPressure; }
        }

        public Wheel(string i_ManufacturerName, float i_MaximalAirPressure)
        {
            m_CurrentAirPressure = 0;
            m_ManufacturerName = i_ManufacturerName;
            m_MaximalAirPressure = i_MaximalAirPressure;
        }

        public void Inflate(float i_PressureToAdd)
        {
            if (m_CurrentAirPressure + i_PressureToAdd <= m_MaximalAirPressure)
            {
                m_CurrentAirPressure += i_PressureToAdd;
            }
            else
            {
                throw new ValueOutOfRangeException(m_CurrentAirPressure + i_PressureToAdd, 0, m_MaximalAirPressure);
            }
        }

        public Dictionary<string, string> GetAllProperties()
        {
            Dictionary<string, string> properties = new Dictionary<string, string>();

            properties.Add("Manufacturer Name", m_ManufacturerName);
            properties.Add("Current Air Pressure", m_CurrentAirPressure.ToString());
            properties.Add("Maximal Air Pressure", m_MaximalAirPressure.ToString());

            return properties;
        }
    }
}
